package org.datascooter.inface;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.ConnectionPoolDataSource;

/**
 * It is a only one way to obtain a database connect in datascooter
 * 
 * @author nemo
 */
public interface IContextConnector {

	/**
	 * Returns a contextId - parameter depicts a type of database
	 * 
	 * @return String
	 */
	public String getContextId();

	/**
	 * Returns database connection
	 * 
	 * @return Connection
	 * @throws SQLException
	 */
	public Connection getConnection() throws SQLException;

	/**
	 * Returns true if this database support pagination
	 * 
	 * @return boolean
	 */
	public boolean isSupportPagination();

	/**
	 * Returns DataSource - container of about database connection info (url, password...)
	 * 
	 * @return IDataSource
	 */
	public IDataSource getDataSource();

	public void close();

	public ConnectionPoolDataSource getSource();

	public boolean isCallParameterMetadata();

	public void setDataSource(IDataSource dataSource) throws SQLException;
}
